import {getCurrentPageUrl} from './get-current-route'

export const shareApp = (path, title) => {
  let _openid = 'openid=' + wx.getStorageSync('user_openid')
  wx.showShareMenu({
    withShareTicket: true
  })
  if (path != null) {
    if (path.indexOf('?') > -1) {
      path += '&' + _openid
    } else {
      path += '?' + _openid
    }
  } else {
    path = `/${getCurrentPageUrl()}?${_openid}`
  }
  console.log('share path', path)
  return {
    title: title || '新马帮',
    path: path
  }
}
